<!--<div id="main-banner"><img src="<?php echo base_url(); ?>images/accomodation_main.jpg" height="320" width="595"></div>-->
    <div id="breadcrumbs"><?php echo $breadcrumb; ?></div>
    <div class="left" id="search_box"><span class="select-beach">Refine Search</span>
        <form name="refinesearch" id="refinesearch" action="<?php echo base_url(); ?>hotel/list_hotels" method="post">
     <?php if($isdestination):?>
            <select class="select-beach" size="1" name="filter" onchange="submitform(this.value)">
       <?php foreach($destination_arr as $arr):?>
		<option  <?php echo ($arr["id"]==$id)?"selected":"";?> value="<?php echo str_replace(" ","-",$arr["destdesc"]) ;?>:<?php echo $arr["id"] ;?>"><?php echo $arr["destdesc"] ;?></option>
       <?php endforeach;?>
		</select>
     <?php else:?>
         <select class="select-beach" size="1" name="sort" onchange="submitform(this.value)">

		<?php foreach($acc_arr as $arr):?>
		<option  <?php echo ($arr["id"]==$id)?"selected":"";?>  value="<?php echo str_replace(" ","-",$arr["accdesc"]) ;?>:<?php echo $arr["id"] ;?>"><?php echo $arr["accdesc"];?></option>
       <?php endforeach;?>

		</select>
     <?php endif;?>
            <select class="select-beach" size="1" name="city" id="city" onchange="filtercity(this.value)">
<option   selected  value="0">--select city--</option>
		<?php foreach($cityarray as $arr):?>
		<option  <?php echo ($arr["city_id"]==$cityid)?"selected":"";?>  value="<?php echo $arr["city_id"];?>"><?php echo $arr["city_name"];?></option>
       <?php endforeach;?>

		</select>
        <select class="select-beach" size="1" id="sorter" name="sorter" onchange="sortsearch(this.value)">
		<option <?php echo ("asc"==$sortorder)?"selected":"";?> value="asc">Sort by Accommodation Name Ascending</option>
        <option <?php echo ("desc"==$sortorder)?"selected":"";?> value="desc">Sort by Accommodation Name Descending</option>
		</select>
     </form>
    </div>

<div>
    <?php
if($hoteldetailarray):
        //print_r($hoteldetailarray);
        //$fac_cls = "";
        foreach ($hoteldetailarray as $hotel_arr) :
            foreach ($hotelfacilityarray[$hotel_arr['hotelid']] as $fac_arr) :
                switch($fac_arr['Hfacility']) {
                    case "Sunbath" :
                        $fac_cls = "<div class='facility_sunbath'></div>";
                        break;
                    case "Restaurant" :
                        $fac_cls .= "<div class='facility_restaurant'></div>";
                        break;
                    case "Bar" :
                        $fac_cls .= "<div class='facility_bar'></div>";
                        break;
                    case "Kidspark" :
                        $fac_cls .= "<div class='facility_kidspark'></div>";
                        break;
                    case "Rafting" :
                        $fac_cls .= "<div class='facility_rafting'></div>";
                        break;
                    case "Swimpool" :
                        $fac_cls .= "<div class='facility_swimpool'></div>";
                        break;
                }
            endforeach;
             
    ?>
  <div id="accom_thumb">
      <p><img src="<?php echo base_url(); ?>images/uploads/thumb/thumb_<?php echo $hotel_arr['image']; ?>" class="acco_thumb_img" height="80" width="100"></p>
     <?php if($hotel_arr['price']>0):?>
     <p>Price : $<?php echo $hotel_arr['price'];?><br>
       (per night)</p>
     <?php endif; ?>
   </div>
   <div id="accom_detail_box">
     <p><strong><?php echo $hotel_arr['hotelname']; ?></strong></p>
     <p><?php echo $hotel_arr['hoteldesc']; ?></p>
     <p>Facilities: <?php echo $fac_cls; ?></p>
     <div class="clear"></div>
     <p>Ratings
         <?php for ($i=0; $i<$hotel_arr['ratingcount']; $i++) { ?>
         <img src="<?php echo base_url(); ?>images/ratings.jpg" alt="" height="19" width="18">
         <?php } ?></p>
     <p><a href="<?php echo base_url(); ?>hotel/hotel_details/hotel_id/<?php echo $hotel_arr['hotelid']; ?>"><img src="<?php echo base_url(); ?>images/readmore.jpg" height="27" width="78"></a></p>
   </div>
    <div class="clear"></div>
    <?php endforeach; ?>


    </div>
    <div id="pagecontroller"><?php echo $pagination;?></div>
        <?php else:?>
     </div>
    <div>no results!</div>
    <?php endif;?>
<div class="clear"></div>

<script type="text/javascript">
function submitform(val)
{
    var url;
    valarr=val.split(":");
    sortorder=document.getElementById("sorter").value;
        url="<?php echo base_url();?>/hotel/list_hotels/"+valarr[0]+"/<?php echo ($isdestination)?"dest_id":"acc_id"; ?>/"+valarr[1]+"/"+sortorder;
       // alert(url);
        window.location=url;
  //  document.forms["refinesearch"].submit("true");
}
function sortsearch(val)
{
        var url;
        sortorder=document.getElementById("sorter").value;

         url="<?php echo base_url();?>/hotel/list_hotels/<?php echo $urisegment3;?>/<?php echo ($isdestination)?"dest_id":"acc_id"; ?>/<?php echo $id;?>/"+val;
        //alert(url);
        window.location=url;
}
function filtercity ()
{
        var url;
        var cityid=document.getElementById("city").value;
        url="<?php echo base_url();?>/hotel/list_hotels/<?php echo $urisegment3;?>/<?php echo ($isdestination)?"dest_id":"acc_id"; ?>/<?php echo $id;?>/<?php echo $sortorder;?>-"+cityid;
       //` alert(url);
        window.location=url;
}
</script>